<?
	include "../classes/init.php";
	
	/* identification de l'usager en SESSION */
	if( isset( $_POST[ 'email' ] ) && isset( $_POST[ 'password' ] ) &&
		 !empty(  $_POST[ 'email' ] ) && !empty(  $_POST[ 'password' ] ) ) {
	
		/* authentification de l'usager avec la BD */
		$objUsager = new Usagers( $objBD );
		$objUsager->setCourriel( $_POST[ 'email' ] );
		$objUsager->setPassword( md5( $_POST[ 'password' ] ) );
		$objUsager->getInfos();
		$tabUsager = $objUsager->getResultats();

		if( count( $tabUsager ) > 0 ) {
			$_SESSION[ 'user_email' ] = $_POST[ 'email' ];
			$_SESSION[ 'user_access' ] = $tabUsager[ 0 ][ 'access' ];
			$_SESSION[ 'user_nom' ] = $tabUsager[ 0 ][ 'nom' ];
			$_SESSION[ 'user_no' ] = $tabUsager[ 0 ][ 'noUsager' ];
			header( "location: accueil_user.php" );
		} else {
			
		} 
	
	} else {
		
	}

?>